﻿using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Kang.Api.Dtos
{
    [JsonObject(MemberSerialization.OptIn)]
    public class ResponseDto
    {
        [SwaggerSchema("状态码")]
        [JsonProperty("code"), JsonPropertyName("code"), DefaultValue(0)]
        public int Code { get; set; }

        [SwaggerSchema("消息")]
        [JsonProperty("msg"), JsonPropertyName("msg"), DefaultValue("")]
        public string Message { get; set; }

        [SwaggerSchema("返回数据")]
        [JsonProperty("data"), JsonPropertyName("data"), DefaultValue(null)]
        public object Data { get; set; }

        public ResponseDto()
        {
        }

        public ResponseDto(int code)
        {
            this.Code = code;
        }

        public ResponseDto(string msg)
        {
            this.Message = msg;
        }

        public ResponseDto(int code, string msg)
        {
            this.Code = code;
            this.Message = msg;
        }

        public ResponseDto(int code, string msg, object data)
        {
            this.Code = code;
            this.Message = msg;
            this.Data = data;
        }
    }
}
